﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Practices.Unity;

namespace EasyInvoice.ApplicationContext
{
    public class AppContext
    {
        private static volatile AppContext instance;
        private static object syncRoot = new Object();

        public IUnityContainer IoC
        {
            get { return ApplicationContainerFactory.Instance.Container; }
        }

        public ParameterProvider Parameters
        {
            get { return IoC.Resolve<ParameterProvider>(); }
        }

        public static AppContext Instance
        {
            get
            {
                if (instance == null)
                {
                    lock (syncRoot)
                    {
                        if (instance == null)
                            instance = new AppContext();
                    }
                }

                return instance;
            }
        }
    }
}
